﻿using Model.BusinessModel.OutPut.sys;
using Model.DomainModel.Sys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure.IRepository.Sys
{
    /// <summary>
    /// 用户与角色关系仓储接口
    /// </summary>
    public interface ISysUserRoleRelationRepository : IRepository<SysUserRoleRelation>
    {
        /// <summary>
        /// 根据用户获取角色关系
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="corporationKey">公司key</param>
        /// <param name="systemKey">系统key</param>
        /// <returns></returns>
        List<SysUserRoleRelationOutPut> GetSysUserRoleRelationsByUserId(string userId, string corporationKey, string systemKey);

        /// <summary>
        /// 根据用户获取角色关系
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="corporationKey">公司key</param>
        /// <returns></returns>
        List<SysUserRoleRelationOutPut> GetSysUserRoleRelationsByUserId(string userId, string corporationKey);

        /// <summary>
        /// 根据用户获取角色关系
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        List<SysUserRoleRelationOutPut> GetSysUserRoleRelationsByUserId(string userId);

        /// <summary>
        /// 根据用户id删除数据
        /// </summary>
        /// <param name="userId">用户id</param>
        void DeleteByUserId(string userId);

        /// <summary>
        /// 根据角色获取角色关系
        /// </summary>
        /// <param name="roleId">角色id</param>
        /// <returns></returns>
        public List<SysUserRoleRelationOutPut> GetSysUserRoleRelationsByRoleId(int roleId);

        /// <summary>
        /// 根据角色id删除数据
        /// </summary>
        /// <param name="roleId">角色id</param>
        void DeleteByRoleId(int roleId);

        /// <summary>
        /// 新增用户和角色关系
        /// </summary>
        /// <param name="list">新增数据</param>
        void BatchInsert(List<SysUserRoleRelation> list);
    }
}
